package com.ee.chat.cps.admin.controller.home;

import com.ee.chat.common.bean.Result;
import com.ee.chat.cps.admin.service.IHomeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author AppiJ
 * @Date 2020/5/15 14:31
 */
@RestController
@RequestMapping("home")
public class HomeController {
    private static Logger log = LoggerFactory.getLogger(HomeController.class);

    @Resource
    IHomeService homeService;

    /**
     * 渠道邀请用户注册量统计数据
     * @Author AppiJ
     * @Date 2020/5/15 14:33
     * @param type  1-月  2-年
     * @return
     */
    @RequestMapping("channelRegisterStatics")
    public Result channelRegisterStatics(HttpServletRequest request, @RequestParam Integer type){
        try{
            return homeService.channelRegisterStatics(request, type);
        }catch (Exception e){
            log.error("【渠道邀请用户注册量统计数据错误】", e);
        }
        return Result.returnFailure();
    }
}
